USE [Transportation]
GO


/****** Object:  View [dbo].[VehicleInfo]    Script Date: 03/27/2014 20:51:41 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


ALTER VIEW [dbo].[VehicleInfo]
AS
SELECT     v.ID AS VehicleID, v.LicensePlateNo, v.[Type], v.DriverID, v.RateLoad, d.Name AS DriverName, d.PhoneNo AS DriverPhoneNo, d.IDNo AS DriverIDNo, 
                      vo.Name AS OwnerName, vo.ContactNo AS OwnerContactNo, v.OwnerID, v.IsActive
                      ,vr.WorkYear
                      ,vr.WorkMonth
                      ,vr.IsActive as RegisterIsActive
                      ,vr.Code
FROM         dbo.Vehicle AS v LEFT OUTER JOIN
                      dbo.Driver AS d ON d.ID = v.DriverID LEFT OUTER JOIN
                      dbo.VehicleOwner AS vo ON v.OwnerID = vo.ID
                      left join VehicleRegister as vr on vr.vehicleID=v.ID
                      left join dbo.DictionaryData da on da.ID=v.[Type]
                      
GO
